package com.example.controller;

import com.example.service.CyclicBarrierExampleService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/cyclic/barrier/example")
public class CyclicBarrierExampleController {

    private final CyclicBarrierExampleService service;

    public CyclicBarrierExampleController(CyclicBarrierExampleService service) {
        this.service = service;
    }

    @GetMapping("/barrier-example")
    public String executeTasksWithBarrier() {
        service.executeTasksWithBarrier();
        return "CyclicBarrier 示例任务已启动";
    }
}
